﻿using System.Net.Sockets;

namespace zTalk.Network
{
    public class SocketClient : SocketBase
    {
        public bool Running { get; set; }
        public string Host { get; set; }
        public int Port { get; set; }

        public SocketClient()
        {
            Socket = new Socket(AddressFamily.InterNetwork, 
                SocketType.Stream, ProtocolType.Tcp);
            buffer = new byte[BUFFER_SIZE];
        }

        public void Start()
        {
            try
            {
                Socket.Connect(Host, Port);
                Running = true;

                startReceive();
            }
            catch (SocketException ex)
            {
                throw ex;
            }
        }
    }
}